package spring.chatroom.java_chatroom.common.constant;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.swing.text.html.HTML;
import java.util.List;
import java.util.Set;

@Component
@ConfigurationProperties(prefix = "file")
public class Constants {

    //    redis key前缀
    public final static String FRIEND_LIST = "FriendList";
    public final static String USERINFO = "UserInfo";


    //判断定时器是否睡眠
    public static Boolean TIMER_IS_SLEEPING = false;

    //RedisError
    public static String REDIS_ERROR = "REDIS_APPLICATION_ERROR";

    public final String PIC_PREFIX = "#{picture}";
    public final String VIDEO_PREFIX = "#{video}";
    public final String DOCUMENT_PREFIX = "#{document}";
    public final String OTHERS_PREFIX = "#{others}";
    public final String[] FILE_PREFIX = {PIC_PREFIX, VIDEO_PREFIX, DOCUMENT_PREFIX, OTHERS_PREFIX};

    @Value("${file.local-pic-path}")
    public String localPicPath;
    @Value("${file.local-video-path}")
    public String localVideoPath;
    @Value("${file.local-document-path}")
    public String localDocPath;
    @Value("${file.local-others-path}")
    public String localOthersPath;
    @Value("${file.local-user-portrait}")
    public String localPortraitPath;
    @Value("${file.local-user-background}")
    public String localBackgroundPath;

    //图片后最
    public final Set<String> picSet = Set.of(".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".svg", ".ico");

    //视频后缀
    public final Set<String> videoSet = Set.of(".mp4",    // MPEG-4 Part 14 (最通用)
            ".avi",    // Audio Video Interleave (古老但常见)
            ".mov",    // QuickTime File Format (Apple)
            ".wmv",    // Windows Media Video
            ".flv",    // Adobe Flash Video (逐渐淘汰)
            ".webm",   // 开放网络媒体格式 (常用于网页)
            ".mkv",    // Matroska Video (开放容器格式，支持多种编码)
            ".m4v",    // iTunes 视频格式
            ".mpg",    // MPEG-1 或 MPEG-2
            ".mpeg",   // MPEG-1 或 MPEG-2
            ".3gp",    // 3GPP 多媒体文件 (旧手机格式)
            ".mts",    // AVCHD 视频文件 (高清摄像机格式)
            ".ts",     // MPEG Transport Stream (常用于流媒体和数字广播)
            ".vob",    // DVD 视频对象
            ".rm",     // RealMedia (逐渐淘汰)
            ".rmvb"   // RealMedia Variable Bitrate);
    );

    //文件后缀
    public final Set<String> documentSet = Set.of(".doc", ".docx", ".pdf", ".rtf", ".txt", ".odt", ".wps", // 文字处理
            ".xls", ".xlsx", ".ods",  // 电子表格
            ".ppt", ".pptx", ".odp",  // 演示文稿
            ".zip", ".rar", ".7z",  // 压缩文件
            ".html", ".htm", ".css", ".xml",  // 网页文件
            ".csv", ".json", ".js", ".py", ".java", ".cpp",  // 文本与代码
            ".ini", ".log");

    public static final String title = "hadage-chat";
}